// mycomponents/myproductlist/myproductlist.js
Component({
  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的属性列表
   */
  properties: {
    activity:Object
  },

  /**
   * 组件的初始数据
   */
  data: {
    isNoCard:false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    couponclick(e) {
      let that = this;
      var item = e.currentTarget.dataset;
      let date = new Date()
      let date1 = new Date(that.data.activity.beginTime.replace(/-/g, '/'))
      console.log(date1)
      let date2 = new Date(that.data.activity.endTime.replace(/-/g, '/'))
      if (date < date1) {
        wx.showToast({
          title: '活动暂未开始',
          icon: 'none'
        })
        return;
      }
      if (date > date2) {
        wx.showToast({
          title: '活动已结束',
          icon: 'none'
        })
        return;
      }
      wx.navigateTo({
        url: '/pages/home/couponDetail/index?stockId=' + item.stockId
      });
    },
  }
})
